package Luogu;

import java.util.Scanner;

public class test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int strat = sc.nextInt();
        int end = sc.nextInt();
        int count = 0;

        for (int i = strat; i <= end; i++) {
            int i1=i;
            while (i1 != 0) {
                int s = i1 % 10;
                if(s==2){
                    count++;
                }
                i1/=10;
            }
        }

        System.out.println(count);
    }
}
